package com.boot.mall.product.config;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@Configuration
@EnableTransactionManagement
@MapperScan("com.boot.mall.product.dao")
public class MyMpConfig {

    /**
     * 分页查询插件
     * @return
     */
    @Bean
    public PaginationInterceptor paginationInterceptor(){
        PaginationInterceptor interceptor = new PaginationInterceptor();
        // 设置请求的页面超过最大页面时，返回首页
        interceptor.setOverflow(true);
        // 设置每页最大为1000条数据
        interceptor.setLimit(1000);
        return interceptor;
    }

}
